package com.learn.algorlthm;

/**
 * @classname:
 * @Description: 斐波那契数列
 * @author: yfpu(fengpu.yang @ ucarinc.com)
 * @Date: 2018-07-06 16:24
 * 题目描述：
 *      https://github.com/CyC2018/Interview-Notebook/blob/master/notes/%E5%89%91%E6%8C%87%20offer%20%E9%A2%98%E8%A7%A3.md#101-%E6%96%90%E6%B3%A2%E9%82%A3%E5%A5%91%E6%95%B0%E5%88%97
 */
public class Learn10_1 {

    private static int[] fib = new int[40];

    static {
        fib[0] = 0;
        fib[1] = 1;

        for (int i = 2; i < fib.length; i++) {
            fib[i] = fib[i-1] + fib[i - 2];
        }
    }

    public static int Fibonacci(int n) {
        return fib[n];
    }

}
